<!-- login START -->
                <?php
if(!checkSession())
{
			function redirect($url)
			{
			?>
				<script type="text/javascript">
					{
					window.location = "<?=$url?>";
					}
				</script>
			<?php 
			}
			redirect("index.php?action=login");
	exit;
}
				?>
<!-- login END -->
<?php 
include('inc/functions_blog.php');
?>
<div id='postpath'>
		<a title="<?php echo translate('gotofrontpage'); ?>" href="index.php"><?php echo translate('home'); ?></a>
		 &gt; <a href="index.php?action=home&sub=stats" title='<?php echo translate('stats'); ?>'><?php echo translate('stats'); ?></a> 
</div>

<br />
<h1><?php echo ucf(translate('stats')); ?></h1>
<br />
<h3><?php echo ucf(translate('today')); ?></h3>
<br />

<?php 		
		echo ucf(translate('wehaveliftedtoday')); ?> <b><?php
        if($w_metric == "kg")
			{
			?><?php echo countKgLiftedToday() ." ". $w_metric; ?> / <?php echo countTonLiftedToday(); ?> <?php echo translate('ton'); ?> 
			<?php
			}
			else
			{
				echo countLbsLiftedToday()." ". $w_metric;
			}
		?>
        </b>
		<?php echo translate('on');?> <b><?php echo countTrainingsToday(); ?> <?php echo translate('trainings'); ?></b> <?php echo translate('distributed'); ?> <?php echo translate('on');?>  <b><?php echo countSetsToday(); ?> <?php echo translate('set');?></b> <?php echo translate('and'); ?> <b><?php echo countRepsToday(); ?> <?php echo translate('reps');?></b>.
        
        <br /><br />
        <?php echo ucf(translate('and')); ?> <?php echo translate('ithas'); ?> <b><?php echo countUsersToday(); ?> <?php echo translate('members'); ?></b> <?php echo translate('used'); ?> <b><?php echo countTimeHoursToday(); ?> <?php echo strtolower(translate('hours')); ?></b> <?php echo translate('on2'); ?>.
        <br /><br />

<br />
<h3><?php echo ucf(translate('totally')); ?></h3>
<br />
		
        <?php 		
		echo ucf(translate('wehavelifted')); ?> <b><?php
        if($w_metric == "kg")
			{
			?><?php echo countKgLifted() ." ". $w_metric; ?> / <?php echo countTonLifted(); ?> <?php echo translate('ton'); ?> 
			<?php
			}
			else
			{
				echo countLbsLifted()." ". $w_metric;
			}
		?>
        </b>
		<?php echo translate('on');?> <b><?php echo countTrainings(); ?> <?php echo translate('trainings'); ?></b> <?php echo translate('distributed'); ?> <?php echo translate('on');?>  <b><?php echo countSets(); ?> <?php echo translate('set');?></b> <?php echo translate('and'); ?> <b><?php echo countReps(); ?> <?php echo translate('reps');?></b>.
        
        <br /><br />
        <?php echo ucf(translate('and')); ?> <?php echo translate('ithas'); ?> <b><?php echo countUsers(); ?> <?php echo translate('members'); ?></b> <?php echo translate('used'); ?> <b><?php echo countTimeHours(); ?> <?php echo strtolower(translate('hours')); ?></b> <?php echo translate('on2'); ?>.
        <br /><br />

        <h2><?php echo translate('whoisonline'); ?> (<?php echo getActiveUsers(); ?>)</h2>
        </b>
        <br />
        <?php
		$active_users = ActiveUsersList("");
		$active_users = subval_sort($active_users, 'last_visit');
		$active_users = array_reverse($active_users);
		
		foreach($active_users as $k => $v)
		{
			$view_page = $v['active_page'];
			$view_page = trim($view_page);
			$last_action = date($CONFIG['date_format_long'], $v['last_visit']);
			echo "<a "; 
			if($v['rank'] >= 1 && $v['rank'] < 3)
			{ 
				echo "style='color:#555555; font-weight: bold;'";
			}
			elseif($v['rank'] == 3)
			{
				echo "style='color:darkblue; font-weight: bold;'";
			}
			elseif($v['rank'] == 5)
			{
				echo "style='color:red; font-weight: bold;'";
			}
			echo " href=\"index.php?action=profile&id=" . $v['user_id'] . "\" title=\" ". ucf(translate('lastvisit')) .": " . $view_page . ", ". translate('lastactive_time') .": " . $last_action;  
			if($v['rank'] == 3)
			{
				echo " (" . translate('moderator') . ")";
			}
			elseif($v['rank'] == 5)
			{
				echo " (" . translate('admin') . ")";
			}
			echo "\">
			<img src='img/flags/16/" . strtolower($v['country']) . ".png' title=" . ucf(getCountryName($v['country'])) ." /> " . $v['firstname'] . " ". $v['lastname'] . "</a> ";
		}
		
		?>